package com.yfqy.app.domain.mapper;

import com.yfqy.app.domain.entity.OrderItem;
import com.yfqy.app.modules.order.dto.OrderItemDTO;
import com.yfqy.app.modules.order.vo.OrderItemRefundVO;
import com.yfqy.app.modules.order.vo.OrderItemVO;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface OrderItemMapper {

    List<OrderItemVO> selectOrderItemsByOrderId(@Param("orderInfoId") Long orderInfoId);

    int selectCountByPromotionId(@Param("userId") Long userId, @Param("promotionId") Long promotionId,
                                 @Param("skuId") Long skuId);

    void batchInsert(@Param("orderItems") List<OrderItem> orderItems);

    List<OrderItemDTO> selectOrderItemDTOsByOrderId(@Param("orderInfoId") Long orderInfoId);

    int countByOrderId(Long orderId);

    int updateOrderItemStatus(@Param("refundOrderItemIds") List<Long> refundOrderItemIds, @Param("status") Byte status);

    List<OrderItemRefundVO> selectOrderItemDTOsByIds(@Param("ids") List<Long> orderItemIds);

    // 根据订单ID列表查询商品
    List<OrderItem> selectByOrderIds(@Param("orderIds") List<Long> orderIds);

    List<OrderItem> selectSalesByOrderIds(@Param("orderIds") List<Long> orderIds);
}